import { Module } from '@nestjs/common';
import { UsersController } from './controllers/users.controller';
import { UsersService } from './services/users.service';
import { UsersEntity } from './entities/user.entity';
import { UserRoleEntity } from './entities/user_role.entity';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UserRoleController } from './controllers/users-role.controller';
import { UserRoleService } from './services/users-role.service';
import { AuthGuard } from '../guard/auth.guard';
import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
import { LoggingInterceptor } from 'src/interceptors/logging.interceptor';
import { LoginController } from './controllers/login.controller';
import { ToolsService } from './services/tools.service';
import { LoginService } from './services/login.service';
import { RedisUtilsService } from 'src/modules/redis-utils/redis-utils.service';

@Module({
  imports: [TypeOrmModule.forFeature([UsersEntity, UserRoleEntity])],
  controllers: [UsersController, UserRoleController, LoginController],
  providers: [
    UsersService,
    UserRoleService,
    LoginService,
    ToolsService,
    // RedisUtilsService,
    // 模块注入守卫，控制两个模块  等同于对类使用装饰器
    // { provide: APP_GUARD, useClass: AuthGuard },
    // 模块注入拦截器
    // { provide: APP_INTERCEPTOR, useClass: LoggingInterceptor },
  ],
})
export class UsersModule {}
